// Copyright (c) MatrixFramework. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Net.Http;
using System.Threading;

namespace Matrix.ServiceCommunication.Resilience;

/// <summary>
/// 容错策略提供者接口
/// </summary>
public interface IResilienceStrategyProvider
{
    /// <summary>
    /// 获取指定服务的容错策略
    /// </summary>
    /// <param name="serviceName">服务名称</param>
    /// <returns>容错策略管道</returns>
    ResiliencePipeline<HttpResponseMessage> GetStrategy(string serviceName);

    /// <summary>
    /// 获取默认容错策略
    /// </summary>
    /// <returns>默认容错策略管道</returns>
    ResiliencePipeline<HttpResponseMessage> GetDefaultStrategy();

    /// <summary>
    /// 清除指定服务的策略缓存
    /// </summary>
    /// <param name="serviceName">服务名称</param>
    void ClearStrategyCache(string serviceName);

    /// <summary>
    /// 清除所有策略缓存
    /// </summary>
    void ClearAllStrategyCache();
}